package com.codebuffer.nowcoder;

public class FindInATwoDimensionalArray {
    public static void main(String[] args) {
        int target = 7;
        int [][] array = {{1,2,8,9},{2,4,9,12},{4,7,10,13},{6,8,11,15}};
        boolean find = Find(target, array);
        System.out.println(find);
    }

    public static boolean Find(int target, int[][] array) {
        boolean b = false;
        int y = array[0].length;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < y; j++) {
                if(array[i][j]==target){
                    return true;
                }
                if(array[i][j]>target){
                    y=j;
                }

            }
        }
        return b;
    }
}
